Part Number Hot Search : 
100AX 20S14 DIP24 ST778AC 1010E B4556 24S330 OM7580SM
Product Description
Full Text Search
 

To Download AN1830 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  an1753/0405 1/15 rev. 1.0 AN1830 application note achieving high accuracy and 13-bit resolution with st7lite2 adc 1 introduction the purpose of this application note is to show users of the st7lite2 adc how to achieve 13- bit resolution with the internal amplifier. it al so explains the software methodology, which can be applied to find and cancel the amplifier offset error. a reference application is shown with implementation of hardware and software filterin g techniques (using an averaging algorithm) to minimize the adc error. please note the data provided with this application note is for reference only, measured in a lab under typical conditions (unless specified otherwise) and not tested in production. 2 st7lite2 adc overview the st7lite2 features a 10-bit successive app roximation converter with internal sample and hold circuitry. the adc is connected to 7 multiplexed analog input channels which allow 7 pins on port b to be used as input for the adc. the adc can be turned on/off using the adon bit, which can help to reduce consumption when not in use. in addition to this it also provides an internal amplifier which can be used for small signal am - plification. 2.1 adc functionality the adc can be connected to any of the analog channels by using the ch[2:0] bits in the ad - ccsr register. this analog input is connected to internal sample and hold circuitry. the output of which is then converted into a 10-bit digital result via successive approximation (refer to figure 1 ). the result of the conversion is stored in a 10-bit data register (adcdrh + ad - cdrl). the analog supply pins v dda and v ssa are the same as v dd and v ss for st7lite2. 1
2/15 achieving high accuracy and 13-bit resolution with st7lite2 adc figure 1 adc block diagram 2.1.1 adc registers the adc functionality is driven using 3 ma in registers adccsr, adcdrh and adcdrl. these are described below. control/status register (adccsr) this is a read/write register used to: - select the analog input channel by using bits ch[2:0] - turn the adc on / off (adon) - select the adc clock speed (speed) - obtain the status of conversion complete cycle (eoc) 7 0 eoc speed adon 0 0 ch2 ch1 ch0 ch2 ch1 eoc speed adon 0 ch0 adccsr ain0 ain1 analog to digital converter ainx analog mux d4 d3 d5 d9 d8 d7 d6 d2 adcdrh 3 d1 d0 adcdrl 00 0 amp slow amp 0 r adc c adc hold control x 1 or x 8 ampsel bit sel f adc f cpu 0 1 1 0 div 2 div 4 slow bit cal 2
3/15 achieving high accuracy and 13-bit resolution with st7lite2 adc data register high (adcdrh) this read only register provides msb d[9:2] of the a/d conversion result. amp control/data register low (adcdrl) the read/write register can be used to: - provide lsb d[1:0] of the a/d conversion result. - select amplifier functionality: amplifie r select and calibration (ampsel and ampcal) - to configure f adc along with the speed bit in the adccsr register (slow) for a detailed description of each bit, refer to the st7lite2 datasheet. 2.2 understanding the adc internal amplifier the purpose of the amplifier is to amplify an input voltage at analog input by a factor of 8. the amplifier output is fed to the adc. the amplifier introduces an offset at the output ( v offset ). thus the output becomes: v out (amplifier) = v offset + 8 x v in where, v offset is the output offset voltage of the amplifier. v in is the amplifier input voltage (= ainx). its range depends on the v dd supply voltage. the amplifier is switched on by the adon bit in the adccsr register, so no additional start- up time is required when the ampl ifier is selected by the ampsel bit. you can also switch between the direct input and the amplified input i.e. the output of the am - plifier can be either equal to its input or equal to the amplified output. this is controlled by the control signal ampsel. 7 0 d9 d8 d7 d6 d5 d4 d3 d2 7 0 0 0 0 amp cal slow amp - sel d1 d0
4/15 achieving high accuracy and 13-bit resolution with st7lite2 adc 2.2.1 amplifier output offset( v offset ): a design factor a deliberate offset has been introduced in the design of the st7lite2 amplifier because in its absence, for the 0v input, the amplifier goes in to saturation and the fina l stage driver transistor inside the amplifier can?t drive the capacitive load inside the adc within the sampling period. this phenomenon also leads to nonlinearity in the transfer curve around 0v input. by intro - ducing the offset, the driver tran sistor is kept in the active region and this problem is avoided. therefore the amplifier offset is a design factor and not an error. 2.2.1.1 amplifier offset variation with respect to temperature one more important point is offset variation with respect to temperature. the offset is quite sensitive to temperature variations. in order to ensure a good reliability in measure - ments, the offset must be recalibrated periodically i.e. may be after ?n? seconds while ap - plication is running depending on application requirement and temperature variation. table 1 typical offset variation at 5v v dd with respect to temperature (1lsb= 4.88mv) 2.2.2 amplifier gain the typical gain of the amplifier is 8 by design, wh ich is a ratio result of 2 on-chip resistors. the mismatch in these 2 resistors can create gain error, depending on the voltage coefficient and temperature. the measured gain error, including adc inaccuracies is around 6% at 25 0 c. 2.2.3 total unadjusted error (tue) the tue is a maximum deviation between the actual and the ideal transfer curves. table 2 below shows the total unadjusted error for different v dd and v in (max) when the am - plifier is on without applying any software or hardware filtering over the temperature range ? 40c to +90c. this is a global tue since it includes adc, amplifier gain, application and offset errors. this can be reduced using the method explained in section 3 . table 2 total unadjusted error ( temperature: ?40c to +90c) 2.2.4 total error in percentage (te%) this section presents 2 graphs showing th e total precision error with respect to v in for tue equal to 10 lsb. the graphs ( figure 2 and figure 3 ) show the variation in error with respect to v in . temperature in 0 c -45 -20 +25 +90 error in lsb -12 -7 0 +13 v dd v in (max) tue 3.6v 350mv 10 lsb 5.0v 500mv 10 lsb
5/15 achieving high accuracy and 13-bit resolution with st7lite2 adc the % te increases for lower voltages, therefore it is recommended that you use the right voltage range depending on the supply voltage v dd . the formula used to calculate te is: total error (te) in worst case conditions = global tue / ((v in x typical gain) / 1lsb ideal ) x100% where, global tue=10lsb typical amplifier gain = 8 1lsb ideal for 5v v dd = 4.88mv 1lsb ideal for 3.6v v dd = 3.5mv figure 2 worst case total error % @ 5v figure 3 worst case total error % @ 3.6v 0 1 2 3 4 5 6 7 0 0.1 0.2 0.3 0.4 0.5 0.6 v in max te% 0 1 2 3 4 5 6 7 8 9 10 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 vin te %
6/15 achieving high accuracy and 13-bit resolution with st7lite2 adc 2.3 operating modes the amplifier functions in different modes depending on the state of the digital control signals ampsel and ampcal. these are explained below, 1) analog input going directly to amplifier output (amplifier off) when the amplifier is off, the adc gets connected to the selected analog channel through sample and hold circuitry. in this the case analog input goes directly to the am - plifier output. the maximum and minimum input that can be given is v dd and v ss respec - tively with a resolution of 10 bits, which is equal to v dd /1024. the state of control signals for this mode should be: ampsel = 0 ampcal = 0 2) analog input amplified and ap pearing at amplifier output (amplifier on) in this case amplifier is on thus adc input is, v out (amplifier) = v offset + 8 x v in the maximum voltage that can be applied at the analog input (v in ) is 500mv at v dd = 5v and 350mv at v dd =3.6v with a resolution of 13 bits. the 13-bit resolution is because the minimum signal that can be measured when the amplifier is on, is 0.6103mv at 5v (e.g. 0.6103 x 8 (2 3 )= 4.8828 = 1lsb for 10-bit adc) and 0.4394mv at 3.6v. this maximum input voltage limitation is due to the nonlinearity of the amplifier as shown in figure 4 in the amplifier transfer curve for 5v.
7/15 achieving high accuracy and 13-bit resolution with st7lite2 adc figure 4 transfer curve for the amplifier when v dd = 5v the state of control signals for this mode should be: ampsel = 1 ampcal = 0 3) amplifier output co rresponds to 0v input (offset calibration) to select this mode the state of the control signals for this mode should be: ampsel= 1 ampcal = 1 since v out at v in = 0v is non-zero, therefore it has to be recorded once and then sub - tracted from each of the amplified-and-converted output digital codes. this offset can be recorded without having to supply 0v at v in . the above modes and the state of digital control signals required for each mode are shown in table 3 . table 3 operating mode operating mode ampsel ampcal amplifier off 0 0 amplifier on 1 0 offset calibration 1 1
8/15 achieving high accuracy and 13-bit resolution with st7lite2 adc 3 techniques to im prove the accuracy 3.1 amplifier offset compensation the adc must be offset-compensated because the output of the amplifier corresponding to 0v input is non-zero (equal to v offset ). this output corresponding to 0v input can be ob - served without having to apply 0v at the input. this is done by using the control signal am - pcal. the amplifier takes the input voltage from the analog pad (after being multiplexed) and ampli - fies it by a factor of 8. in addition to this, it also introduces an offset at the output, which varies from one part to another due to manufacturing process variations. for this reason the adc should be calibrated by c onfiguring 0v once, storing it as an offset and subtracting it from all amplified-and-converted digital codes. thus compensated adc output = adc read data - offset cnt (when ampcal=1) refer to table 5 to understand how it is used. 3.2 software averaging software averaging is a method used to reduce the effect of erroneous adc output because of noise or wrong conversion for fixed analog input. as we take the average of several readings, these readings must correspond to the same an - alog input voltage. take care that the analog input remains at the same voltage during the time period when the conversions are done. otherwise digital values corresponding to dif - ferent analog inputs will get ad ded and introduce erro rs, i.e. the analog input should not change between the different readings considered for the averaging.
9/15 achieving high accuracy and 13-bit resolution with st7lite2 adc figure 5 averaging algorithm table 4 is for reference only, representing the relation between the number of samples and the accuracy. after 25 samples, it shows an lsb accuracy of 2. the number of samples to choose depends on the application (noise leve l and timing) as these two are directly propor - tional. the disadvantage of having too many samples is that it takes more time to convert the data. table 4 number of samples vs. accuracy number of samples accuracy in lsb 10 4 20 3 25 2 30 2 40 2 50 2 start initialize adc variables, and select analog channel, total = 0 start adc read the adc output registers after end of conversion add read value to total num. of conv. = n? yes no average = total / n use the result
10/15 achieving high accuracy and 13-bit resolution with st7lite2 adc 3.3 hardware filtering figure 6 shows the hardware setup used in the reference application. to minimize the effect of external noise (on the supply and input signal), shielded core wire is used with capacitors c1 = c2 = 0.01f, c3 = 1000f, c4 =100f. these capacitors should be placed very close to the device input pins with short leads. the values of these capacitors may vary fr om application to application, as they depend on noise behavior and supply type. care should be taken regarding the shield; all grounds and shields in the application must be connected in star format to earth. in addition to this you can use a precision voltage reference to reduce the effect of supply noise on conversion accuracy. this can have the disadvantage of extra cost. figure 6 hardware setup 4 reference application the resolution of the adc is 13-bit when the amplifier is on, so even a small amount of noise can create an error at output. this noise could be from the supply or the signal. to filter this out and to obtain correct converted data it is suggested to use different software and hardware techniques depending on your application requ irements, like hardware filtering/shielding/soft - ware averaging/histogram etc. however, taking into account this fact, the reference application has been provided showing the implementation of software averaging, offset compensation and hardware filtering (refer to section 3.3 for hardware filtering). supply ground analog input c2 c3 c4 + + _ _ c1, c2 = ceramic capacitors c3, c4 = electrolytic capacitors v dd st7lite2 v ss ain0/pbo application board (v in ) c1
11/15 achieving high accuracy and 13-bit resolution with st7lite2 adc 4.1 software flow in software, firstly the ampcal and ampsel bits are set. then the adc is sampled for a de - fined number of times and averaged. this output is then stored in eeprom as an offset. this is then used in a program to get precise adc output by subtracting it from subsequent adc samples (refer to figure 7 ). a total of 100 readings are taken and stored in eeprom for the same analog input. and each reading has a result of 25 averaged samples + offset compensation. these are to allow you to compare it directly with respect to analog input. however, the samples to be taken depend on the application so it is user-configurable. this can be changed by using the ?no_of_sample? value in software.
12/15 achieving high accuracy and 13-bit resolution with st7lite2 adc figure 7 software flow please refer to table 5 this represents adc data with and without filtering in addition to data before and after offset compensation. it shows that the adc is highly accurate provided care is taken to reduce application noise, as the resolution of adc is 13-bit. save ?avg? as an offset in eeprom yes take ?n? (=25) adc . initialize variables initialize adc in ?offset calibration? mode samples & find out ?avg.? select ain0 with amplifier on cnt > 100? take ?n? (=25) adc s amples & find out ?avg.? adc cnt = avg - offset store avg. as adc out- put in eeprom no (offset compensation) end start cnt = 0 cnt = cnt + 1
13/15 achieving high accuracy and 13-bit resolution with st7lite2 adc table 5 adc analysis (before and after filter) where: offset cnt = 58 in lsb (ampcal=1) ideal adc cnt = (v in x 8) /4.88 (at 5v) adc output in lsb ( adcdrh + adcdrl) = ((v in x 8) + v offset ) / 4.88 adc output in lsb (offset compensated) = adc output in lsb ( adcdrh + adcdrl) - offset cnt 5 conclusion overall, the st7lite2 adc + amplifier is a good price/performance trade-off with effective resolution of 13-bit, which can be used in variou s applications where small signal amplification is required with minimum hardware interface. the accuracy of the adc is also good, provided you take note of v offset and keep external noise to a minimum for which you can use different techniques explained above. with these techniques we are able to restrict the adc er ror within 3 lsb at room temperature with am - plifier on. an important thing to remember while using the st7lite2 amplifier is the ?offset compensa - tion?, which is mandatory due to the design of the device. v in (at ain0) in mv ideal adc cnt in lsb adc output in lsb adcdrh + adcdrl adc output in lsb (off - set compensated) max min max min 50 82 145 136 87 78 200 328 393 383 335 325 400 656 718 710 660 652 adc output with h/w and s/w filtering (in lsb) 50 82 141 140 83 82 200 328 388 383 330 325 400 656 716 714 658 656
14/15 achieving high accuracy and 13-bit resolution with st7lite2 adc 6 references to find out more about different adc errors and compensating techniques, refer to the fol - lowing application notes available on http://www.st.com an1711: software techniques for compensating st7 adc errors an1636: understanding and minimizing adc conversion errors 7 example software the complete software can be found on the st internet website in a zipped file format. it is in - tended for use only as an example. it is up to you to adapt it to your specific application re - quirements. the source file is for guidance only. stmicroelect ronics shall not be held liable for any direct, indirect or consequential damages with respect to any claims arising from use of this software.
15/15 achieving high accuracy and 13-bit resolution with st7lite2 adc ?the present note which is for guidance only aims at providing customers with information regarding their products in order for them to save time. as a result, stmicroelectronics shall not be held liable for any direct, indirect or consequential damages with respect to any claims arising from the content of such a note and/or the use made by customers of the information contained herein in connection with their products.? information furnished is believed to be accurate and reliable. however, stmicroelectronics assumes no responsibility for the co nsequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. no license is granted by implication or otherwise under any patent or patent rights of stmicroelectronics. specifications mentioned in this publicati on are subject to change without notice. this publication supersedes and replaces all information previously supplied. stmicroelectronics prod ucts are not authorized for use as critical components in life support devices or systems without express written approval of stmicroelectro nics. the st logo is a registered trademark of stmicroelectronics. all other names are the property of their respective owners ? 2005 stmicroelectronics - all rights reserved stmicroelectronics group of companies australia ? belgium - brazil - canada - china ? czech republic - finland - france - germany - hong kong - india - israel - ital y - japan - malaysia - malta - morocco - singapore - spain - sweden - switzerland - united kingdom - united states of america www.st.com


▲Up To Search▲   

 
Price & Availability of AN1830

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X